package com.sh.mapper;

import com.sh.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Entity com.sh.pojo.User
 */
public interface UserMapper {

    //登录功能
    User login(@Param("username") String username, @Param("password") String password);

    //展示带查询
    List<User> show(@Param("username") String username);

    //添加用户
    @Insert("insert into t_user values(default,#{truename},#{username},#{password})")
    int insert(@Param("username") String username,@Param("truename") String truename, @Param("password") String password);

    //修改用户
    @Update("update t_user set username=#{username},truename=#{truename} where id=#{id}")
    int update(@Param("id") Integer id,@Param("username") String username,@Param("truename") String truename);

    //删除用户
    @Delete("delete from t_user where id = #{id}")
    int del(Integer id);
}




